﻿//进度状态
var progressStatus = false;
//材料类型
var materialType = "";
//铜箔编号
var cuFoilNum = "";
//PP/PCF料号PPPartNo
var ppRCFPartNum1 = "";
var ppRCFPartNum2 = "";
//PP 半固化片种类数
var ppTypeNumber = 0;
//pp 半固化片数量
var ppNumber = 0;
//流程卡时间
var travellerDate = "";

$(function () {
    
    //Lot 批号(上条码)
    $("input[name='lotBatch']").keydown(function (e) {

        if (e.keyCode == 13) {

            //验证
            var equipmentCode = $("input[name='account']").val();
            var staffNum = $("input[name='staffNum']").val();
            var shiftNum = $("select[name='shiftNum']").find("option:selected").val();
            var shiftNumText = $("select[name='shiftNum']").find("option:selected").text();
            var totalpanelQuan = $("input[name='totalpanelQuan']").val();
            var totalsecionQuan = $("input[name='totalsecionQuan']").val();

            if (Topro.Util.isNullOrEmptySpance(equipmentCode)) {
                Topro.UI.Tip_short_warning("机台编码不能为空.");
                return false;
            }

            if (Topro.Util.isNullOrEmptySpance(staffNum)) {
                Topro.UI.Tip_short_warning("员工号不能为空.");
                return false;
            }

            if (Topro.Util.isNullOrEmptySpance(shiftNum) || shiftNum==0) {
                Topro.UI.Tip_short_warning("请选择班次.");
                return false;
            }

            if (Topro.Util.isNullOrEmptySpance(totalpanelQuan)) {
                Topro.UI.Tip_short_warning("总板数不能为空！");
                return;
            }

            if (Topro.Util.isNullOrEmptySpance(totalsecionQuan)) {
                Topro.UI.Tip_short_warning("切片数不能为空！");
                return;
            }

            var data = {
                lotBatch: $(this).val(),
                equipmentCode: equipmentCode,
                staffNum: staffNum,
                shiftNum: shiftNumText
            };

            Topro.Util.Ajax({
                type: "POST",
                url: "/Home/LotBatch",
                data: data,
                success: function (res) {
                    if (res.success) {
                        $("input[name='lotBatch']").val(res.data.lotBatch);
                        $("input[name='partNum']").val(res.data.partNum);
                        $("input[name='heapNumber']").val(res.data.heapNumber);
                        $("input[name='materialType']").val(res.data.materialType);
                        if (!Topro.Util.isNullOrEmptySpance(res.data.bookBuildupStructure)) {
                            $("input[name='bookBuildupStructure']").val(res.data.bookBuildupStructure)
                        } else {
                            $("input[name='bookBuildupStructure']").val('')
                        }
                        if (!Topro.Util.isNullOrEmptySpance(res.data.pressProgram)) {
                            $("input[name='pressProgram']").val(res.data.pressProgram)
                        } else {
                            $("input[name='pressProgram']").val('')
                        }

                        if (!Topro.Util.isNullOrEmptySpance(res.data.ppNumber)) {
                            ppNumber = res.data.ppNumber;
                        } else {
                            ppNumber = 0
                        }
                        
                        //提示
                        if (!Topro.Util.isNullOrEmptySpance(res.data.tips)) {
                            Topro.UI.DialogBox({
                                id: 'dialog_confirm',
                                title: '操作',
                                parent: true,
                                lock: true,
                                fixed: true,
                                icon: 'question',
                                padding: '20px 15px 20px 10px',
                                ok: function () {
                                    $("input[name='programbarCode']").focus();
                                },
                                width: '200px',
                                content: '请注意左边工程师设定信息!',
                            });
                            var url = '/Home/Info?equipmentCode=' + equipmentCode + '&staffNum=' + staffNum + '&shiftNum=' + shiftNumText + '';
                            if (res.data.count > 0) {
                                Topro.UI.DialogOpen(url, {
                                    title: "消息",
                                    width: 600,
                                    height: 500,
                                    init: function () {
                                        this.button({ name: "关闭" });
                                    }
                                });
                            }

                            //公告
                            //var htmls = doT.template($("#tpl").text());
                            //$(".info .list").html(htmls(""));
                            $(".console").html(res.data.tips);

                        } else {
                            $(".console").html('');
                        }

                        //获取焦点
                        $("input[name='programbarCode']").focus();
                    } else {
                        $("input[name='lotBatch']").val("");
                        $("input[name='partNum']").val("");
                        $("input[name='heapNumber']").val("");
                        $("input[name='materialType']").val("");
                        $("input[name='bookBuildupStructure']").val("");
                        $("input[name='pressProgram']").val("");
                        $("input[name='secionQuan']").val("");

                        $(".console").html("");
                        Topro.UI.Tip_short_warning("操作失败！" + res.message);
                    }
                },
                error: function (json) {
                    Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                }
            });

            return false;
        }
    });
    //物料/程式信息(下条码)
    $("input[name='programbarCode']").keydown(function (event) {

        if (event.which == 13) {
            var lotBatch = $("input[name='lotBatch']").val();
            var partNum = $("input[name='partNum']").val();
            var heapNumber = $("input[name='heapNumber']").val();
            //总板数
            var totalpanelQuan = $("input[name='totalpanelQuan']").val();
            if (Topro.Util.isNullOrEmptySpance(totalpanelQuan)) {
                Topro.UI.Tip_short_warning("总板数不能为空！");
                return;
            }
            //切片数
            var totalsecionQuan = $("input[name='totalsecionQuan']").val();
            if (Topro.Util.isNullOrEmptySpance(totalsecionQuan)) {
                Topro.UI.Tip_short_warning("切片数不能为空！");
                return;
            }
            //材料类型
            materialType = $("input[name='materialType']").val();
            //满本结构
            var bookBuildupStructure = $("input[name='bookBuildupStructure']").val();

            if (Topro.Util.isNullOrEmptySpance(materialType)) {
                Topro.UI.DialogBox({
                    id: 'dialog_alert',
                    title: '.',
                    parent: true,
                    lock: true,
                    fixed: true,
                    padding: '20px 15px 20px 10px',
                    ok: function () {
                        $("input[name='programbarCode']").val('');
                    },
                    width: '200px',
                    content: '请选择材料类型.',
                    close: true,
                    icon: 'warning'
                });
            }
            else {

                var programbarCode = $(this).val();

                var data = {
                    lotBatch: lotBatch,
                    partNum: partNum,
                    heapNumber: heapNumber,
                    programbarCode: programbarCode,
                    materialType: materialType,
                    totalpanelQuan: totalpanelQuan,
                    totalsecionQuan: totalsecionQuan,
                    bookBuildupStructure: bookBuildupStructure
                };

                //还原
                ppTypeNumberA = 0;

                Topro.Util.Ajax({
                    type: "POST",
                    url: "/Home/ProgrambarCode",
                    data: data,
                    success: function (res) {
                        if (res.success) {
                            //程式条码
                            $("input[name='lowerBarCode']").val(res.data.lowerBarCode);
                            //进度状态
                            progressStatus = res.data.cuFoilNum;
                            //铜箔编号
                            cuFoilNum = res.data.cuFoilNum;
                            //LOT料号1
                            ppRCFPartNum1 = res.data.pprcfPartNum1;
                            //LOT料号2
                            ppRCFPartNum2 = res.data.pprcfPartNum2;
                            //PP 半固化片种类数
                            ppTypeNumber = res.data.PPTypeNumber;
                            //材料类型
                            materialType = res.data.materialType;
                            //扫码时间
                            travellerDate = res.data.travellerDate;
                            //


                            if (!Topro.Util.isNullOrEmptySpance(travellerDate)) {
                                $("input[name='travellerDate']").val(travellerDate);
                            }
                            //PP 半固化片种类数
                            $("input[name='ppTypeNumber']").val(res.data.ppTypeNumber);
                            //压合程式
                            var pressProgram = $("input[name='pressProgram']").val();
                            //压合程式是否为空
                            if (Topro.Util.isNullOrEmptySpance(pressProgram)) {
                                $("input[name='pressProgram']").val(res.data.pressProgram);
                            }

                            //判断是否有值
                            var bookBuildupStructure = $("input[name='bookBuildupStructure']").val();
                            if (Topro.Util.isNullOrEmptySpance(bookBuildupStructure)) {
                                $("input[name='bookBuildupStructure']").val(res.data.bookBuildupStructure);
                            }

                            $("input[name='programbarCode']").val("");
                            //获取焦点
                            $("input[name='cuFoilNum']").focus();

                            if (res.data.plateResponse != null) {
                                $(".NoBookNums1_1").html(res.data.plateResponse.noBookNums1_1);
                                $(".NoCommPlate1_1").html(res.data.plateResponse.noCommPlate1_1);
                                $(".NoUpSteelPlateNums1_1").html(res.data.plateResponse.noUpSteelPlateNums1_1);
                                $(".NoDownSteelPlateNums1_1").html(res.data.plateResponse.noDownSteelPlateNums1_1);

                                $(".NoBookNums1_2").html(res.data.plateResponse.noBookNums1_2);
                                $(".NoCommPlate1_2").html(res.data.plateResponse.noCommPlate1_2);
                                $(".NoUpSteelPlateNums1_2").html(res.data.plateResponse.noUpSteelPlateNums1_2);
                                $(".NoDownSteelPlateNums1_2").html(res.data.plateResponse.noDownSteelPlateNums1_2);

                                $(".BookNums2_1").html(res.data.plateResponse.bookNums2_1);
                                $(".CommPlate2_1").html(res.data.plateResponse.commPlate2_1);
                                $(".CrossPlate2_1").html(res.data.plateResponse.crossPlate2_1);
                                $(".UpSteelPlateNums2_1").html(res.data.plateResponse.upSteelPlateNums2_1);
                                $(".DownSteelPlateNums2_1").html(res.data.plateResponse.downSteelPlateNums2_1);

                                $(".BookNums2_2").html(res.data.plateResponse.bookNums2_2);
                                $(".CommPlate2_2").html(res.data.plateResponse.commPlate2_2);
                                $(".CrossPlate2_2").html(res.data.plateResponse.crossPlate2_2);
                                $(".UpSteelPlateNums2_2").html(res.data.plateResponse.upSteelPlateNums2_2);
                                $(".DownSteelPlateNums2_2").html(res.data.plateResponse.downSteelPlateNums2_2);
                            }
                            //Book数
                            if (!Topro.Util.isNullOrEmptySpance(res.data.bookNum)) {
                                $("input[name='bookNum']").val(res.data.bookNum);
                            }

                        } else {
                            Topro.UI.Tip_short_warning("操作失败！" + res.message);
                        }
                    },
                    error: function (json) {
                        Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                    }
                });
            }

            return false;
        }

    });
    //PP 半固化片数量
    $("input[name='ppNumber']").blur(function (e) {

        debugger;
        var value = $(this).val();

        if (Topro.Util.isNullOrEmptySpance(value)) {
            Topro.UI.Tip_short_warning("PP 半固化片数量不能为空！");
            return;
        }

        if (ppNumber != 0) {
            if (value != ppNumber) {
                Topro.UI.DialogBox({
                    id: 'dialog_confirm',
                    title: '操作',
                    parent: true,
                    lock: true,
                    fixed: true,
                    icon: 'question',
                    padding: '20px 15px 20px 10px',
                    okVal: '是',
                    ok: function () {

                    },
                    cancelVal: '否',
                    width: '200px',
                    content: '半固化片数量与上次不一致,是否继续.',
                    cancel: function () {
                        $("input[name='ppNumber']").val(ppNumber);
                    }
                })
            }
        }
        return false;
    });
    //Cu Foil Num 铜箔编号
    $("input[name='cuFoilNum']").keydown(function (e) {

        if (e.keyCode == 13) {

            var content = $(this).val();

            var data = {
                PressProgramCuFoilNum: cuFoilNum,
                CuFoilNum: content,
                MaterialType: materialType
            };

            Topro.Util.Ajax({
                type: "POST",
                url: "/Home/CuFoilNum",
                data: data,
                success: function (res) {
                    if (res.success) {
                        if (materialType == "Cu_pp") {
                            //对比铜箔编号是否一致
                            if (cuFoilNum != res.data.cuFoilNum) {
                                Topro.UI.DialogBox({
                                    id: 'dialog_confirm',
                                    title: '操作',
                                    parent: true,
                                    lock: true,
                                    fixed: true,
                                    icon: 'question',
                                    padding: '20px 15px 20px 10px',
                                    okVal: '是',
                                    ok: function () {
                                        $("input[name='cuFoilNum']").val(res.data.cuFoilNum);
                                        $("input[name='cuFoilBatchNum']").val(res.data.cuFoilBatch);
                                        $("input[name='cuFoilExpire']").focus();
                                    },
                                    cancelVal: '否',
                                    width: '200px',
                                    content: '铜箔编号与流程卡不一致,是否继续.',
                                    cancel: function () {
                                        $("input[name='cuFoilNum']").val('');
                                    }
                                })
                            }
                            else {
                                $("input[name='cuFoilNum']").val(res.data.cuFoilNum);
                                $("input[name='cuFoilBatchNum']").val(res.data.cuFoilBatch);
                                $("input[name='cuFoilExpire']").focus();
                            }
                        }
                        else{
                            $("input[name='cuFoilNum']").val(res.data.cuFoilNum);
                            $("input[name='cuFoilBatchNum']").val(res.data.cuFoilBatch);
                            $("input[name='cuFoilExpire']").focus();
                        }
                    } else {
                        $("input[name='cuFoilNum']").val("");
                        $("input[name='cuFoilBatchNum']").val("");
                        Topro.UI.Tip_short_warning("操作失败！" + res.message);
                    }
                },
                error: function (json) {
                    Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                }
            });

            return false;
        }

    });
    //Cu Foil Num 铜箔编号
    $("input[name='cuFoilNum']").blur(function (e) {

        var content = $(this).val();

        if (materialType == "Cu_pp") {
            //对比铜箔编号是否一致
            if (cuFoilNum != content) {
                Topro.UI.DialogBox({
                    id: 'dialog_confirm',
                    title: '操作',
                    parent: true,
                    lock: true,
                    fixed: true,
                    icon: 'question',
                    padding: '20px 15px 20px 10px',
                    okVal: '是',
                    ok: function () {
                        $("input[name='cuFoilNum']").val('');
                        $("input[name='cuFoilBatchNum']").val('');
                    },
                    cancelVal: '否',
                    width: '200px',
                    content: '铜箔编号与流程卡不一致,是否继续.',
                    cancel: function () {
                        $("input[name='cuFoilNum']").val('');
                    }
                })
            }
        }
        return false;
    });
    //Cu Foil Expire 铜箔有效期
    $("input[name='cuFoilExpire']").blur(function (e) {

        var content = $(this).val();

        var data = {
            content: content
        };

        Topro.Util.Ajax({
            type: "POST",
            url: "/Home/CuFoilExpire",
            data: data,
            success: function (res) {
                if (!res.success) {
                    Topro.UI.DialogBox({
                        id: 'dialog_alert',
                        title: '.',
                        parent: true,
                        lock: true,
                        fixed: true,
                        padding: '20px 15px 20px 10px',
                        ok: function () {
                            $("input[name='cuFoilExpire']").val("");
                        },
                        width: '200px',
                        content: '铜箔有效期已过期,请确认.',
                        close: true,
                        icon: 'warning'
                    });
                }
            },
            error: function (json) {
                Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
            }
        });

        return false;
    });
    //Package Num包号1_1
    $("input[name='packageNum1_1']").keydown(function (e) {
        if (e.keyCode == 13) {

            var content = $(this).val();

            var data = {
                content: content
            };

            Topro.Util.Ajax({
                type: "POST",
                url: "/Home/packageNum1_1",
                data: data,
                success: function (res) {
                    if (res.success) {
                        
                        if (materialType == "Cu_pp") {
                            if (Topro.Util.isNullOrEmptySpance(res.data.expire)) {
                                $("input[name='packageNum1_1']").val(res.data.packageNum);
                                $("input[name='materialDate']").val(res.data.materialDate);
                                $("input[name='ppPcfPartNum1_1']").focus();
                            } else {
                                Topro.UI.DialogBox({
                                    id: 'dialog_confirm',
                                    title: '操作',
                                    parent: true,
                                    lock: true,
                                    fixed: true,
                                    icon: 'question',
                                    padding: '20px 15px 20px 10px',
                                    ok: function () {
                                        $("input[name='packageNum1_1']").val('');
                                    },
                                    width: '200px',
                                    content: res.data.expire,
                                });
                            }
                            
                        } else {
                            if (Topro.Util.isNullOrEmptySpance(res.data.expire)) {
                                $("input[name='packageNum1_1']").val(res.data.packageNum);
                                $("input[name='materialDate']").val(res.data.materialDate);
                                $("input[name='ppPcfPartNum1_1']").focus();
                            }
                            else {
                                Topro.UI.DialogBox({
                                    id: 'dialog_confirm',
                                    title: '操作',
                                    parent: true,
                                    lock: true,
                                    fixed: true,
                                    icon: 'question',
                                    padding: '20px 15px 20px 10px',
                                    ok: function () {
                                        $("input[name='packageNum1_1']").val('');
                                    },
                                    width: '200px',
                                    content: res.data.expire,
                                });
                            }
                        }
                    } else {
                        $("input[name='packageNum1_1']").val("");
                        $("input[name='materialDate']").val("");
                        Topro.UI.Tip_short_warning("操作失败！" + res.message);
                    }
                },
                error: function (json) {
                    Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                }
            });

            return false;
        }
    });
    //PP/PCF 料号1_1
    $("input[name='ppPcfPartNum1_1']").keydown(function (e) {
        if (e.keyCode == 13) {

            var content = $(this).val();

            var data = {
                content: content
            };

            Topro.Util.Ajax({
                type: "POST",
                url: "/Home/PpPcfPartNum1_1",
                data: data,
                success: function (res) {
                    if (res.success) {
                        debugger;
                        if (materialType == "Cu_pp") {
                            if (ppRCFPartNum1 != res.data.ppPcfPartNum1) {
                                Topro.UI.DialogBox({
                                    id: 'dialog_alert',
                                    title: '.',
                                    parent: true,
                                    lock: true,
                                    fixed: true,
                                    padding: '20px 15px 20px 10px',
                                    ok: function () {
                                        $("input[name='ppPcfPartNum1_1']").val('');
                                    },
                                    width: '200px',
                                    content: 'PP/PCF 料号与流程卡信息不一致,请确认.',
                                    close: true,
                                    icon: 'warning'
                                });
                            }
                            else {
                                $("input[name='ppPcfPartNum1_1']").val(res.data.ppPcfPartNum1);
                                $("input[name='ppPcfBatchNum1_1']").val(res.data.ppPcfBatchNum1);
                                $("input[name='ppPcfExpire1_1']").focus();
                            }
                        } else {
                            $("input[name='ppPcfPartNum1_1']").val(res.data.ppPcfPartNum1);
                            $("input[name='ppPcfBatchNum1_1']").val(res.data.ppPcfBatchNum1);
                            //获取焦点
                            $("input[name='ppPcfExpire1_1']").focus();
                        }
                    } else {
                        $("input[name='ppPcfPartNum1_1']").val('');
                        $("input[name='ppPcfBatchNum1_1']").val('');
                        Topro.UI.Tip_short_warning("操作失败！" + res.message);
                    }
                },
                error: function (json) {
                    Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                }
            });

            return false;
        }
    });
    //PP/PCF 料号1_1
    $("input[name='ppPcfPartNum1_1']").blur(function (e) {

        var content = $(this).val();

        if (ppRCFPartNum1 != content) {
            Topro.UI.DialogBox({
                id: 'dialog_alert',
                title: '.',
                parent: true,
                lock: true,
                fixed: true,
                padding: '20px 15px 20px 10px',
                ok: function () {
                    $("input[name='ppPcfPartNum1_1']").val('');
                    $("input[name='ppPcfBatchNum1_1']").val('');
                },
                width: '200px',
                content: 'PP/PCF 料号与流程卡信息不一致,请确认.',
                close: true,
                icon: 'warning'
            });
        }
        return false;
    });
    //PP/PCF 有效期1_1
    $("input[name='ppPcfExpire1_1']").keydown(function (e) {
        if (e.keyCode == 13) {

            var content = $(this).val();

            var data = {
                content: content
            };

            Topro.Util.Ajax({
                type: "POST",
                url: "/Home/ppPcfExpire1_1",
                data: data,
                success: function (res) {
                    if (res.success) {
                        //获取焦点
                        $("input[name='postponedMaterial1']").focus();
                    } else {
                        Topro.UI.Tip_short_warning("操作失败！" + res.message);
                    }
                },
                error: function (json) {
                    Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                }
            });

            return false;
        }
    });
    //Package Num包号1_2
    $("input[name='packageNum1_2']").keydown(function (e) {
        if (e.keyCode == 13) {
            var content = $(this).val();

            var data = {
                content: content
            };

            Topro.Util.Ajax({
                type: "POST",
                url: "/Home/packageNum1_2",
                data: data,
                success: function (res) {
                    if (res.success) {
                        if (Topro.Util.isNullOrEmptySpance(res.data.expire)) {
                            $("input[name='packageNum1_2']").val(res.data.packageNum);
                            $("input[name='ppPcfPartNum1_2']").focus();
                        } else {
                            Topro.UI.DialogBox({
                                id: 'dialog_confirm',
                                title: '操作',
                                parent: true,
                                lock: true,
                                fixed: true,
                                icon: 'question',
                                padding: '20px 15px 20px 10px',
                                ok: function () {
                                    $("input[name='packageNum1_2']").val('');
                                },
                                width: '200px',
                                content: res.data.expire,
                            });
                        }
                    } else {
                        $("input[name='packageNum1_2']").val("");
                        Topro.UI.Tip_short_warning("操作失败！" + res.message);
                    }
                },
                error: function (json) {
                    Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                }
            });

            return false;
        }
    });
    //PP/PCF 料号1_2
    $("input[name='ppPcfPartNum1_2']").keydown(function (e) {
        if (e.keyCode == 13) {

            var content = $(this).val();

            var data = {
                content: content
            };

            Topro.Util.Ajax({
                type: "POST",
                url: "/Home/PpPcfPartNum1_2",
                data: data,
                success: function (res) {
                    if (res.success) {
                        if (materialType == "Cu_pp") {
                            if (ppRCFPartNum1 != res.data.ppPcfPartNum1) {
                                Topro.UI.DialogBox({
                                    id: 'dialog_alert',
                                    title: '.',
                                    parent: true,
                                    lock: true,
                                    fixed: true,
                                    padding: '20px 15px 20px 10px',
                                    ok: function () {
                                        $("input[name='ppPcfPartNum1_2']").val('');
                                        $("input[name='ppPcfBatchNum1_2']").val('');
                                    },
                                    width: '200px',
                                    content: 'PP/PCF 料号与流程卡信息不一致,请确认.',
                                    close: true,
                                    icon: 'warning'
                                });
                            }
                        }
                        $("input[name='ppPcfPartNum1_2']").val(res.data.ppPcfPartNum1);
                        $("input[name='ppPcfBatchNum1_2']").val(res.data.ppPcfBatchNum1);
                        //获取焦点
                        $("input[name='ppPcfExpire1_2']").focus();
                    } else {
                        $("input[name='ppPcfPartNum1_2']").val('');
                        $("input[name='ppPcfBatchNum1_2']").val('');
                        Topro.UI.Tip_short_warning("操作失败！" + res.message);
                    }
                },
                error: function (json) {
                    Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                }
            });

            return false;
        }
    });
    //PP/PCF 料号1_2
    $("input[name='ppPcfPartNum1_2']").blur(function (e) {

        var content = $(this).val();

        if (ppRCFPartNum1 != content) {
            Topro.UI.DialogBox({
                id: 'dialog_alert',
                title: '.',
                parent: true,
                lock: true,
                fixed: true,
                padding: '20px 15px 20px 10px',
                ok: function () {
                    $("input[name='ppPcfPartNum1_2']").val('');
                    $("input[name='ppPcfBatchNum1_2']").val('');
                },
                width: '200px',
                content: 'PP/PCF 料号与流程卡信息不一致,请确认.',
                close: true,
                icon: 'warning'
            });
        }
        return false;
    });
    //PP/PCF 料号1_2
    $("input[name='ppPcfPartNum1_2']").blur(function (e) {

        var content = $(this).val();

        if (ppRCFPartNum1 != content) {
            Topro.UI.DialogBox({
                id: 'dialog_alert',
                title: '.',
                parent: true,
                lock: true,
                fixed: true,
                padding: '20px 15px 20px 10px',
                ok: function () {
                    $("input[name='ppPcfPartNum1_2']").val("");
                    $("input[name='ppPcfBatchNum1_2']").val("");
                },
                width: '200px',
                content: 'PP/PCF 料号与流程卡信息不一致,请确认.',
                close: true,
                icon: 'warning'
            });
        }
        return false;
    });
    //PP/PCF 有效期1_2
    $("input[name='ppPcfExpire1_2']").keydown(function (e) {
        if (e.keyCode == 13) {

            var content = $(this).val();

            var data = {
                content: content
            };

            Topro.Util.Ajax({
                type: "POST",
                url: "/Home/ppPcfExpire1_2",
                data: data,
                success: function (res) {
                    if (res.success) {
                        //获取焦点
                        $("input[name='postponedMaterial2']").focus();
                    } else {
                        Topro.UI.Tip_short_warning("操作失败！" + res.message);
                    }
                },
                error: function (json) {
                    Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                }
            });

            return false;
        }
    });
    //Package Num包号2_1
    $("input[name='packageNum2_1']").keydown(function (e) {
        if (e.keyCode == 13) {
            var content = $(this).val();

            var data = {
                content: content
            };

            Topro.Util.Ajax({
                type: "POST",
                url: "/Home/packageNum2_1",
                data: data,
                success: function (res) {
                    if (res.success) {
                        if (Topro.Util.isNullOrEmptySpance(res.data.expire)) {
                            $("input[name='packageNum2_1']").val(res.data.packageNum);
                            //获取焦点
                            $("input[name='ppPcfPartNum2_1']").focus();
                        } else {
                            Topro.UI.DialogBox({
                                id: 'dialog_confirm',
                                title: '操作',
                                parent: true,
                                lock: true,
                                fixed: true,
                                icon: 'question',
                                padding: '20px 15px 20px 10px',
                                ok: function () {
                                    $("input[name='packageNum2_1']").val('');
                                },
                                width: '200px',
                                content: res.data.expire,
                            });
                        }
                    } else {
                        $("input[name='packageNum2_1']").val("");
                        Topro.UI.Tip_short_warning("操作失败！" + res.message);
                    }
                },
                error: function (json) {
                    Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                }
            });

            return false;
        }
    });
    //PP/PCF 料号2_1
    $("input[name='ppPcfPartNum2_1']").keydown(function (e) {
        if (e.keyCode == 13) {

            var content = $(this).val();

            var data = {
                content: content
            };

            Topro.Util.Ajax({
                type: "POST",
                url: "/Home/PpPcfPartNum2_1",
                data: data,
                success: function (res) {
                    if (res.success) {
                        debugger;
                        if (materialType == "Cu_pp") {
                            if (ppRCFPartNum2 != res.data.ppPcfPartNum1) {
                                Topro.UI.DialogBox({
                                    id: 'dialog_alert',
                                    title: '.',
                                    parent: true,
                                    lock: true,
                                    fixed: true,
                                    padding: '20px 15px 20px 10px',
                                    ok: function () {
                                        $("input[name='ppPcfPartNum2_1']").val('');
                                        $("input[name='ppPcfBatchNum2_1']").val('');
                                    },
                                    width: '200px',
                                    content: 'PP/PCF 料号与流程卡信息不一致,请确认.',
                                    close: true,
                                    icon: 'warning'
                                });
                            }
                            else {
                                $("input[name='ppPcfPartNum2_1']").val(res.data.ppPcfPartNum1);
                                $("input[name='ppPcfBatchNum2_1']").val(res.data.ppPcfBatchNum1);
                                $("input[name='ppPcfExpire2_1']").focus();
                            }
                        }
                        else {
                            $("input[name='ppPcfPartNum2_1']").val(res.data.ppPcfPartNum1);
                            $("input[name='ppPcfBatchNum2_1']").val(res.data.ppPcfBatchNum1);
                            $("input[name='ppPcfExpire2_1']").focus();
                        }
                    } else {
                        $("input[name='ppPcfPartNum2_1']").val('');
                        $("input[name='ppPcfBatchNum2_1']").val('');
                        Topro.UI.Tip_short_warning("操作失败！" + res.message);
                    }
                },
                error: function (json) {
                    Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                }
            });

            return false;
        }
    });
    //PP/PCF 料号2_1
    $("input[name='ppPcfPartNum2_1']").blur(function (e) {

        var content = $(this).val();

        if (ppRCFPartNum2 != content) {
            Topro.UI.DialogBox({
                id: 'dialog_alert',
                title: '.',
                parent: true,
                lock: true,
                fixed: true,
                padding: '20px 15px 20px 10px',
                ok: function () {
                    $("input[name='ppPcfPartNum2_1']").val('');
                    $("input[name='ppPcfBatchNum2_1']").val('');
                },
                width: '200px',
                content: 'PP/PCF 料号与流程卡信息不一致,请确认.',
                close: true,
                icon: 'warning'
            });
        }
        return false;
    });
    //PP/PCF 料号2_1
    $("input[name='ppPcfPartNum2_1']").blur(function (e) {

        var content = $(this).val();

        if (ppRCFPartNum2 != content) {
            Topro.UI.DialogBox({
                id: 'dialog_alert',
                title: '.',
                parent: true,
                lock: true,
                fixed: true,
                padding: '20px 15px 20px 10px',
                ok: function () {
                    $("input[name='ppPcfPartNum2_1']").val('');
                    $("input[name='ppPcfBatchNum2_1']").val('');
                },
                width: '200px',
                content: 'PP/PCF 料号与流程卡信息不一致,请确认.',
                close: true,
                icon: 'warning'
            });
        }
        return false;
    });
    //PP/PCF 有效期2_1
    $("input[name='ppPcfExpire2_1']").keydown(function (e) {
        if (e.keyCode == 13) {

            var content = $(this).val();

            var data = {
                content: content
            };

            Topro.Util.Ajax({
                type: "POST",
                url: "/Home/PpPcfExpire2_1",
                data: data,
                success: function (res) {
                    if (res.success) {
                        //获取焦点
                        $("input[name='postponedMaterial2_1']").focus();
                    } else {
                        Topro.UI.Tip_short_warning("操作失败！" + res.message);
                    }
                },
                error: function (json) {
                    Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                }
            });
            return false;
        }
    });
    //Package Num包号2_2
    $("input[name='packageNum2_2']").keydown(function (e) {
        if (e.keyCode == 13) {
            var content = $(this).val();

            var data = {
                content: content
            };

            Topro.Util.Ajax({
                type: "POST",
                url: "/Home/packageNum2_2",
                data: data,
                success: function (res) {
                    if (res.success) {
                        if (Topro.Util.isNullOrEmptySpance(res.data.expire)) {
                            $("input[name='packageNum2_2']").val(res.data.packageNum);
                            $("input[name='ppPcfPartNum2_2']").focus();
                        } else {
                            Topro.UI.DialogBox({
                                id: 'dialog_confirm',
                                title: '操作',
                                parent: true,
                                lock: true,
                                fixed: true,
                                icon: 'question',
                                padding: '20px 15px 20px 10px',
                                ok: function () {
                                    $("input[name='packageNum2_2']").val('');
                                },
                                width: '200px',
                                content: res.data.expire,
                            });
                        }
                    } else {
                        $("input[name='packageNum2_2']").val("");
                        Topro.UI.Tip_short_warning("操作失败！" + res.message);
                    }
                },
                error: function (json) {
                    Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                }
            });

            return false;
        }
    });
    //PP/PCF 料号2_2
    $("input[name='ppPcfPartNum2_2']").keydown(function (e) {
        if (e.keyCode == 13) {

            var content = $(this).val();

            var data = {
                content: content
            };

            Topro.Util.Ajax({
                type: "POST",
                url: "/Home/PpPcfPartNum2_2",
                data: data,
                success: function (res) {
                    if (res.success) {
                        if (materialType == "Cu_pp") {
                            if (ppRCFPartNum2 != res.data.ppPcfPartNum1) {
                                Topro.UI.DialogBox({
                                    id: 'dialog_alert',
                                    title: '.',
                                    parent: true,
                                    lock: true,
                                    fixed: true,
                                    padding: '20px 15px 20px 10px',
                                    ok: function () {
                                        $("input[name='ppPcfPartNum2_2']").val('');
                                        $("input[name='ppPcfBatchNum2_2']").val('');
                                    },
                                    width: '200px',
                                    content: 'PP/PCF 料号与流程卡信息不一致,请确认.',
                                    close: true,
                                    icon: 'warning'
                                });
                            }
                            else {
                                $("input[name='ppPcfPartNum2_2']").val(res.data.ppPcfPartNum1);
                                $("input[name='ppPcfBatchNum2_2']").val(res.data.ppPcfBatchNum1);
                                $("input[name='ppPcfExpire2_2']").focus();
                            }
                        }
                        else {
                            $("input[name='ppPcfPartNum2_2']").val(res.data.ppPcfPartNum1);
                            $("input[name='ppPcfBatchNum2_2']").val(res.data.ppPcfBatchNum1);
                            //获取焦点
                            $("input[name='ppPcfExpire2_2']").focus();
                        }
                    } else {
                        $("input[name='ppPcfPartNum2_2']").val('');
                        $("input[name='ppPcfBatchNum2_2']").val('');
                        Topro.UI.Tip_short_warning("操作失败！" + res.message);
                    }
                },
                error: function (json) {
                    Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                }
            });

            return false;
        }
    });
    //PP/PCF 料号2_2
    $("input[name='ppPcfPartNum2_2']").blur(function (e) {

        var content = $(this).val();

        if (ppRCFPartNum2 != content) {
            Topro.UI.DialogBox({
                id: 'dialog_alert',
                title: '.',
                parent: true,
                lock: true,
                fixed: true,
                padding: '20px 15px 20px 10px',
                ok: function () {
                    $("input[name='ppPcfPartNum2_2']").val('');
                    $("input[name='ppPcfBatchNum2_2']").val('');
                },
                width: '200px',
                content: 'PP/PCF 料号与流程卡信息不一致,请确认.',
                close: true,
                icon: 'warning'
            });
        }
        return false;
    });
    //PP/PCF 有效期2_2
    $("input[name='ppPcfExpire2_2']").keydown(function (e) {
        if (e.keyCode == 13) {

            var content = $(this).val();

            var data = {
                content: content
            };

            Topro.Util.Ajax({
                type: "POST",
                url: "/Home/PpPcfExpire2_2",
                data: data,
                success: function (res) {
                    if (res.success) {
                        //获取焦点
                        $("input[name='postponedMaterial2_2']").focus();
                    } else {
                        Topro.UI.Tip_short_warning("操作失败！" + res.message);
                    }
                },
                error: function (json) {
                    Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                }
            });
            return false;
        }
    });

    $(".switch").click(function () {
        $(".pp2").show();
    });
    //保存
    $(".save").click(function () {
        save();
    });
    //关闭
    $(".reset").click(function () {
        reset();
    });
});

function reset() {
    //Lot 批号(上条码)：
    $("input[name='lotBatch']").val('');
    //Part Num 料号
    $("input[name='partNum']").val('');
    //Heap Number 叠合次数号
    $("input[name='heapNumber']").val('');
    //Material Type 材料类型
    $("input[name='materialType']").val('');
    //下条码扫描提示信息
    $("input[name='lowerBarCode']").val('流程卡物料/程式条形码还未扫描');
    //Press Program 压合程式
    $("input[name='pressProgram']").val('');
    //Cu Foil Num 铜箔编号
    $("input[name='cuFoilNum']").val('');
    //Cu Foil Batch 铜箔批号
    $("input[name='cuFoilBatchNum']").val('');
    //Cu Foil Expire 铜箔有效期
    $("input[name='cuFoilExpire']").val('');
    //PP 半固化片种类数
    $("input[name='ppTypeNumber']").val('');
    //PP 半固化片数量
    $("input[name='ppNumber']").val('');
    //PP1
    //Postponed Material1_1零包OR整包
    $("select[name='postponedMaterialType1_1']").find("option[value=0]").attr("selected", true);

    //1_1
    //Package Num包号1_1
    $("input[name='packageNum1_1']").val('');
    //PP/PCF 料号1_1
    $("input[name='ppPcfPartNum1_1']").val('');
    //PP/PCF 批号1_1
    $("input[name='ppPcfBatchNum1_1']").val('');
    //PP/PCF 有效期1_1
    $("input[name='ppPcfExpire1_1']").val('');
    //Postponed Material延期材料1_1
    $("select[name='postponedMaterial1_1']").find("option[value=0]").attr("selected", true);

    //1_2
    //Postponed Material1_2零包OR整包
    $("select[name='postponedMaterialType1_2']").find("option[value=0]").attr("selected", true);

    //Package Num包号1_2
    $("input[name='packageNum1_2']").val('');
    //PP/PCF 料号1_2
    $("input[name='ppPcfPartNum1_2']").val('');
    //PP/PCF 批号1_2
    $("input[name='ppPcfBatchNum1_2']").val('');
    //PP/PCF 有效期1_2
    $("input[name='ppPcfExpire1_2']").val('');
    //Postponed Material延期材料1_2
    $("select[name='postponedMaterial1_2']").find("option[value=0]").attr("selected", true);

    //PP2
    //Postponed Material2_1零包OR整包
    $("select[name='postponedMaterialType2_1']").find("option[value=0]").attr("selected", true);
    //2_1
    //Package Num包号2_1
    $("input[name='packageNum2_1']").val('');
    //PP/PCF 料号1_1
    $("input[name='ppPcfPartNum2_1']").val('');
    //PP/PCF 批号1_1
    $("input[name='ppPcfBatchNum2_1']").val('');
    //PP/PCF 有效期1_1
    $("input[name='ppPcfExpire2_1']").val('');
    //Postponed Material延期材料1_1
    $("select[name='postponedMaterial2_1']").find("option[value=0]").attr("selected", true);

    //2_2
    //Postponed Material2_2零包OR整包
    $("select[name='postponedMaterialType2_2']").find("option[value=0]").attr("selected", true);
    //Package Num包号2_2
    $("input[name='packageNum2_2']").val('');
    //PP/PCF 料号1_2
    $("input[name='ppPcfPartNum2_2']").val('');
    //PP/PCF 批号1_2
    $("input[name='ppPcfBatchNum2_2']").val('');
    //PP/PCF 有效期1_2
    $("input[name='ppPcfExpire2_2']").val('');
    //Postponed Material延期材料1_1
    $("select[name='postponedMaterial2_2']").find("option[value=0]").attr("selected", true);

    //Book Buildup Structure满本结构
    $("input[name='bookBuildupStructure']").val('');
    //1.5mm Plate 垫厚钢板数
    $("input[name='plateNum']").val('');
    //Panel Quan 板数
    $("input[name='panelQuan']").val('');
    //Secion Quan 含切片的板数
    $("input[name='secionQuan']").val('');
    //Alpha Board Stay Time棕化停留时间
    $("input[name='alphaBoardStayTime']").val('');
    //Stopper Quality 防滑质量
    $("select[name='stopperQuality']").find("option[value=10]").attr("selected", true);
    //Perpreg Surface Quality 表面质量
    $("select[name='perpregSurfaceQuality']").find("option[value=10]").attr("selected", true);
    //14 Pcs Kraft Quality 14张牛皮纸数量
    $("select[name='pcsKraftQuality']").find("option[value=10]").attr("selected", true);
    //Inner Core Quality 内层芯板质量
    $("select[name='innerCoreQuality']").find("option[value=10]").attr("selected", true);
    //Copper Foil Quality 铜箔质量
    $("select[name='copperFoilQuality']").find("option[value=10]").attr("selected", true);
    //Abnormal Steel Plate Quantity异常钢板
    $("input[name='abnormalSteelPlateQuantity']").val('');
    //
    $("input[name='travellerDate']").val('');
    //
    $("input[name='materialDate']").val('');
    //底板编码
    $("input[name='containerCode']").val('');
    //Book数
    $("input[name='bookNum']").val('');
    //备注
    $("input[name='remark']").val('');
    //
    $(".console").html('请注意、左边工程师设定!');
}

function save() {

    var data = $("#form").serializeJSON();
    //resize
    $(window).resize();
    //弹出层
    //var cover = Topro.UI.Mask({ obj: $("body"), opacity: 0.5 });
    //料号1
    data.PPRCFPartNum1 = ppRCFPartNum1;
    //料号2
    data.PPRCFPartNum2 = ppRCFPartNum2;
    
    //Account 机台编码
    data.Account = $("input[name='account']").val();
    //Plant Num 厂号
    data.plntNum = $("input[name='plntNum']").val();
    //Staff Num 员工号
    data.staffNum = $("input[name='staffNum']").val();
    //Shift Num 班次
    data.shiftNum = $("select[name='shiftNum']").find("option:selected").val();
    //Equipment Code 设备编码
    data.equipmentCode = $("input[name='equipmentCode']").val();
    //Lot 批号(上条码)：
    data.lotBatch = $("input[name='lotBatch']").val();
    //Part Num 料号
    data.partNum = $("input[name='partNum']").val();
    //Heap Number 叠合次数号
    data.heapNumber = $("input[name='heapNumber']").val();
    //Material Type 材料类型
    data.materialType = $("input[name='materialType']").val();
    //
    //
    //LowerBarCode 程式条码
    data.lowerBarCode = $("input[name='lowerBarCode']").val();
    //Press Program 压合程式
    data.pressProgram = $("input[name='pressProgram']").val();
    //Cu Foil Num 铜箔编号
    data.cuFoilNum = $("input[name='cuFoilNum']").val();

    //Cu Foil Batch 铜箔批号
    data.cuFoilBatchNum = $("input[name='cuFoilBatchNum']").val();
    //Cu Foil Expire 铜箔有效期
    data.cuFoilExpire = $("input[name='cuFoilExpire']").val();
    //PP 半固化片种类数
    data.ppTypeNumber = $("input[name='ppTypeNumber']").val();
    //PP 半固化片数量
    data.ppNumber = $("input[name='ppNumber']").val();
    //PP1
    //Postponed Material1_1零包OR整包
    data.postponedMaterialType1_1 = $("select[name='postponedMaterialType1_1']").find("option:selected").val();

    //1_1
    //Package Num包号1_1
    data.packageNum1_1 = $("input[name='packageNum1_1']").val();
    //PP/PCF 料号1_1
    data.ppPcfPartNum1_1 = $("input[name='ppPcfPartNum1_1']").val();
    //PP/PCF 批号1_1
    data.ppPcfBatchNum1_1 = $("input[name='ppPcfBatchNum1_1']").val();
    //PP/PCF 有效期1_1
    data.ppPcfExpire1_1 = $("input[name='ppPcfExpire1_1']").val();
    //Postponed Material延期材料1_1
    data.postponedMaterial1_1 = $("select[name='postponedMaterial1_1']").find("option:selected").val();

    //1_2

    //Postponed Material1_1零包OR整包
    data.postponedMaterialType1_2 = $("select[name='postponedMaterialType1_2']").find("option:selected").val();
    //Package Num包号1_2
    data.packageNum1_2 = $("input[name='packageNum1_2']").val();
    //PP/PCF 料号1_2
    data.ppPcfPartNum1_2 = $("input[name='ppPcfPartNum1_2']").val();
    //PP/PCF 批号1_2
    data.ppPcfBatchNum1_2 = $("input[name='ppPcfBatchNum1_2']").val();
    //PP/PCF 有效期1_2
    data.ppPcfExpire1_2 = $("input[name='ppPcfExpire1_2']").val();
    //Postponed Material延期材料1_2
    data.postponedMaterial1_2 = $("select[name='postponedMaterial1_2']").find("option:selected").val();

    //PP2
    //Postponed Material2_1零包OR整包
    data.postponedMaterialType2_1 = $("select[name='postponedMaterialType2_1']").find("option:selected").val();
    //2_1
    //Package Num包号2_1
    data.packageNum2_1 = $("input[name='packageNum2_1']").val();
    //PP/PCF 料号1_1
    data.ppPcfPartNum2_1 = $("input[name='ppPcfPartNum2_1']").val();
    //PP/PCF 批号1_1
    data.ppPcfBatchNum2_1 = $("input[name='ppPcfBatchNum2_1']").val();
    //PP/PCF 有效期1_1
    data.ppPcfExpire2_1 = $("input[name='ppPcfExpire2_1']").val();
    //Postponed Material延期材料1_1
    data.postponedMaterial2_1 = $("select[name='postponedMaterial2_1']").find("option:selected").val();

    //2_2
    //Postponed Material2_2零包OR整包
    data.postponedMaterialType2_2 = $("select[name='postponedMaterialType2_2']").find("option:selected").val();
    //Package Num包号2_2
    data.packageNum2_2 = $("input[name='packageNum2_2']").val();
    //PP/PCF 料号1_2
    data.ppPcfPartNum2_2 = $("input[name='ppPcfPartNum2_2']").val();
    //PP/PCF 批号1_2
    data.ppPcfBatchNum2_2 = $("input[name='ppPcfBatchNum2_2']").val();
    //PP/PCF 有效期1_2
    data.ppPcfExpire2_2 = $("input[name='ppPcfExpire2_2']").val();
    //Postponed Material延期材料1_1
    data.postponedMaterial2_2 = $("select[name='postponedMaterial2_2']").find("option:selected").val();

    //Book Buildup Structure满本结构
    data.bookBuildupStructure = $("input[name='bookBuildupStructure']").val();
    //1.5mm Plate 垫厚钢板数
    data.plateNum = $("input[name='plateNum']").val();
    //Panel Quan 板数
    data.panelQuan = $("input[name='panelQuan']").val();
    //Secion Quan 含切片的板数
    data.secionQuan = $("input[name='secionQuan']").val();
    //Alpha Board Stay Time棕化停留时间
    data.alphaBoardStayTime = $("input[name='alphaBoardStayTime']").val();
    //Stopper Quality 防滑质量
    data.stopperQuality = $("select[name='stopperQuality']").find("option:selected").val();
    //Perpreg Surface Quality 表面质量
    data.perpregSurfaceQuality = $("select[name='perpregSurfaceQuality']").find("option:selected").val();
    //14 Pcs Kraft Quality 14张牛皮纸数量
    data.pcsKraftQuality = $("select[name='pcsKraftQuality']").find("option:selected").val();
    //Inner Core Quality 内层芯板质量
    data.innerCoreQuality = $("select[name='innerCoreQuality']").find("option:selected").val();
    //Copper Foil Quality 铜箔质量
    data.copperFoilQuality = $("select[name='copperFoilQuality']").find("option:selected").val();
    //Steel Plate Quality 纲板质量
    data.steelPlateQuality = $("select[name='steelPlateQuality']").find("option:selected").val();
    //Abnormal Steel Plate Quantity异常钢板
    data.abnormalSteelPlateQuantity = $("input[name='abnormalSteelPlateQuantity']").val();
    //容器编码
    data.containerCode = $("input[name='containerCode']").val();
    //流程卡时间
    data.travellerDate = $("input[name='travellerDate']").val();
    //流程卡时间
    data.materialDate = $("input[name='materialDate']").val();
    //Book数
    data.bookNum = $("input[name='bookNum']").val();
    //备注
    data.remark = $("input[name='remark']").val();
    //disabled
    $("button[name='save']").attr("disabled", true);

    Topro.Util.Ajax({
        type: "POST",
        url: "/Home/Save",
        data: data,
        success: function (res) {
            if (res.success) {
                Topro.UI.DialogBox({
                    id: 'dialog_confirm',
                    title: '操作',
                    parent: true,
                    lock: true,
                    fixed: true,
                    icon: 'question',
                    padding: '20px 15px 20px 10px',
                    ok: function () {
                        //材料类型
                        materialType = "";
                        //铜箔编号
                        cuFoilNum = "";
                        //PP/PCF料号PPPartNo
                        ppRCFPartNum1 = "";
                        PPRCFPartNum2 = "";
                        //PP 半固化片种类数
                        ppTypeNumber = 0;
                        //流程卡时间
                        travellerDate = "";
                    },
                    width: '200px',
                    content: '新增成功！',
                    cancel: function () {
                    }
                });
                //disabled
                $("button[name='save']").attr("disabled", false);
                reset();
            } else {
                Topro.UI.DialogBox({
                    id: 'dialog_confirm',
                    title: '操作',
                    parent: true,
                    lock: true,
                    fixed: true,
                    icon: 'question',
                    padding: '20px 15px 20px 10px',
                    ok: function () {
                    },
                    width: '200px',
                    content: "操作失败！" + res.message,
                    cancel: function () {
                    }
                });
                //disabled
                $("button[name='save']").attr("disabled", false);
            }
        },
        error: function (json) {
            //disabled
            $("button[name='save']").attr("disabled", false);
            Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
        }
    });

}

function insertRow(obj) {

    if (obj.Type != undefined) {
        switch (obj.Type) {
            case 10:
                $("input[name='heapNumber']").val(obj.Name);
                break;
            case 20:
                $("input[name='materialType']").val(obj.Name);
                break;
            case 30:
                $("input[name='pressProgram']").val(obj.Name);
                break;
            case 40:
                $("input[name='bookBuildupStructure']").val(obj.Name);
                break;

            case 181:
                $("input[name='postponedMaterial1']").val(obj.Name);
                break;
            case 221:
                $("input[name='postponedMaterial2']").val(obj.Name);
                break;
            case 230:
                $("input[name='plaeType']").val(obj.Name);
                break;

            case 280:
                $("input[name='rotateLayup']").val(obj.Name);
                break;
        }
    }

}